{include file="index/head" /}
<div class="box">
  {if condition="$v.id neq ''"}
  <div class="form" style="border:1px solid #eee; margin-top:25px; padding-top:0px;">
    <div class="ht" style="border-bottom:1px solid #eee; padding:12px; margin-bottom:25px; color:#909ba5; background:#f5f8fb;">{$name}管理</div>
    <form method="post" action="{:url('topimg')}" class="sycmsform">
      <input type="hidden" name="id" value="{$v.id}" />
      <input type="hidden" name="type" value="{$type}" />
      <ul class="tabcon" style="display:block;">
        <li>
          <label>所属栏目：</label>
          <div class="item">
            <input type="text" readonly="readonly" class="input" value="{$v.title}" readonly="readonly" style="background:#f7f7f7;" />
          </div>
        </li>
         {if condition="$type eq 'pc'"}
         <li>
          <label>顶部图片：</label>
          <div class="item"> 
            <input type="text" name="img" class="input" value="{$v.img}"/>
            <button type="button" class="button fl" onclick="sycms.showupload(this)" id="image1" at="dg"><i class="icon-plus"></i>上传图片</button>
            <span class="tips">{$size}</span>
            <div class="clear"></div>
            <div class="input-image">{if $v.img}<img src="{$v.img}" alt="" />{/if}</div>         
          </div>
        </li>  
        {else}
         <li>
          <label>顶部图片：</label>
          <div class="item"> 
            <input type="text" name="img1" class="input" value="{$v.img1}"/>
            <button type="button" class="button fl" onclick="sycms.showupload(this)" id="image1" at="dg"><i class="icon-plus"></i>上传图片</button>
            <span class="tips">{$size}</span>
            <div class="clear"></div>
            <div class="input-image">{if $v.img1}<img src="{$v.img1}" alt="" />{/if}</div>         
          </div>
        </li>  
        {/if}    
      <ul>
        <li>
          <label>&nbsp;</label>
          <div class="item">
            <button type="submit" class="button"><i class="icon-check"></i>编辑</button> <button type="button" onclick="javascript:history.go(-1);" class="button"><i class="icon-mail-reply (alias)"></i>返回</button>
          </div>
        </li>
      </ul>
    </form>
    <br />
  </div>
  {else}
  <div class="box-head">
    <h2>{$name}列表</h2>
    <div class="fr">
      &nbsp;<a href="javascript:history.go(-1);" class="btn fr"><i class="icon-mail-reply (alias)"></i>返回</a></div>
  </div>
  <table class="table">
    <tr>
      <th width="100">ID</th>
      <th width="20%">所属栏目</th>
      <th>图片</th>
      <th width="200">操作</th>
    </tr>
    {volist name="list" id="v"}
    <tr>
      <td>{$v.id}</td>
      <td>{$v.title}</td>
      {if condition="$type eq 'pc'"}
      <td><img src="{$v.img}" alt="" style="max-width:200px; max-height:50px;" /></td>   
      {else}
      <td><img src="{$v.img1}" alt="" style="max-width:200px; max-height:50px;" /></td>   
      {/if}   
      <td><a href="{:url('topimg',['id'=>$v.id,'type'=>$type])}" class="btn"><i class="icon-edit"></i> 编辑</a> </td>
    </tr>
    {/volist}
    <tr>
    <td colspan="4"><div class="page">{$page}</div></td>
    </tr>
  </table>     
  {/if}
</div>
<script> 
sycms.submitform("{:url('topimg',['type'=>$type])}"); 
</script>